<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>usr_05 - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />

<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>

<body>

<header>

<div class="header">
  <a href="http://vim-jp.org/">vim-jp</a>
  / <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
  / usr_05<br />
  <a name="top"></a><h1>usr_05 - Vim Documentation</h1>
  <a href="index.html">Return to main</a>

  <span class="EnglishJapaneseLink">
    <span class="CurrentLanguage">English</span>
  </span>
</div>
</header>

<nav>
<dl>

<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>

<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>

<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>

<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>

<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>

<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>

<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>

<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>

<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>

<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>

<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>

<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>

<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>

<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>

<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>

<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>

<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>

</dl>
</nav>

<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="usr_05.html" name="usr_05.txt">usr_05.txt</a>&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;<span class="Identifier">Vim version 8.0.</span>&nbsp;&nbsp;Last change: 2016 Mar 28<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIM USER MANUAL - by Bram Moolenaar<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set your settings<br>
<br>
<br>
Vim can be tuned to work like you want it to.&nbsp;&nbsp;This chapter shows you how to<br>
make Vim start with options set to different values.&nbsp;&nbsp;Add plugins to extend<br>
Vim's capabilities.&nbsp;&nbsp;Or define your own macros.<br>
<br>
<a class="Identifier" href="usr_05.html#05.1">05.1</a>&nbsp;&nbsp;The vimrc file<br>
<a class="Identifier" href="usr_05.html#05.2">05.2</a>&nbsp;&nbsp;The example vimrc file explained<br>
<a class="Identifier" href="usr_05.html#05.3">05.3</a>&nbsp;&nbsp;Simple mappings<br>
<a class="Identifier" href="usr_05.html#05.4">05.4</a>&nbsp;&nbsp;Adding a package<br>
<a class="Identifier" href="usr_05.html#05.5">05.5</a>&nbsp;&nbsp;Adding a plugin<br>
<a class="Identifier" href="usr_05.html#05.6">05.6</a>&nbsp;&nbsp;Adding a help file<br>
<a class="Identifier" href="usr_05.html#05.7">05.7</a>&nbsp;&nbsp;The option window<br>
<a class="Identifier" href="usr_05.html#05.8">05.8</a>&nbsp;&nbsp;Often used options<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; Next chapter:&nbsp;<a class="Identifier" href="usr_06.html">usr_06.txt</a>&nbsp;&nbsp;Using syntax highlighting<br>
&nbsp;Previous chapter:&nbsp;<a class="Identifier" href="usr_04.html">usr_04.txt</a>&nbsp;&nbsp;Making small changes<br>
Table of contents:&nbsp;<a class="Identifier" href="usr_toc.html">usr_toc.txt</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.1" name="05.1">05.1</a>&nbsp;&nbsp;The vimrc file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#vimrc-intro" name="vimrc-intro">vimrc-intro</a><br>
<br>
You probably got tired of typing commands that you use very often.&nbsp;&nbsp;To start<br>
Vim with all your favorite option settings and mappings, you write them in<br>
what is called the vimrc file.&nbsp;&nbsp;Vim executes the commands in this file when it<br>
starts up.<br>
<br>
If you already have a vimrc file (e.g., when your sysadmin has one setup for<br>
you), you can edit it this way:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:edit $MYVIMRC</div>
<br>
If you don't have a vimrc file yet, see&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a>&nbsp;to find out where you can<br>
create a vimrc file.&nbsp;&nbsp;Also, the &quot;:version&quot; command mentions the name of the<br>
&quot;user vimrc file&quot; Vim looks for.<br>
<br>
For Unix and Macintosh this file is always used and is recommended:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">~/.vimrc</span><br>
<br>
For MS-DOS and MS-Windows you can use one of these:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">$HOME/_vimrc</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">$VIM/_vimrc</span><br>
<br>
The vimrc file can contain all the commands that you type after a colon.&nbsp;&nbsp;The<br>
most simple ones are for setting options.&nbsp;&nbsp;For example, if you want Vim to<br>
always start with the&nbsp;<a class="Type" href="options.html#'incsearch'">'incsearch'</a>&nbsp;option on, add this line your vimrc file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set incsearch</div>
<br>
For this new line to take effect you need to exit Vim and start it again.<br>
Later you will learn how to do this without exiting Vim.<br>
<br>
This chapter only explains the most basic items.&nbsp;&nbsp;For more information on how<br>
to write a Vim script file:&nbsp;<a class="Identifier" href="usr_41.html">usr_41.txt</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.2" name="05.2">05.2</a>&nbsp;&nbsp;The example vimrc file explained&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#vimrc_example.vim" name="vimrc_example.vim">vimrc_example.vim</a><br>
<br>
In the first chapter was explained how the example vimrc (included in the<br>
Vim distribution) file can be used to make Vim startup in not-compatible mode<br>
(see&nbsp;<a class="Identifier" href="usr_01.html#not-compatible">not-compatible</a>).&nbsp;&nbsp;The file can be found here:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">$VIMRUNTIME/vimrc_example.vim</span><br>
<br>
In this section we will explain the various commands used in this file.&nbsp;&nbsp;This<br>
will give you hints about how to set up your own preferences.&nbsp;&nbsp;Not everything<br>
will be explained though.&nbsp;&nbsp;Use the &quot;:help&quot; command to find out more.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set nocompatible</div>
<br>
As mentioned in the first chapter, these manuals explain Vim working in an<br>
improved way, thus not completely Vi compatible.&nbsp;&nbsp;Setting the&nbsp;<a class="Type" href="options.html#'compatible'">'compatible'</a><br>
option off, thus&nbsp;<a class="Type" href="options.html#'nocompatible'">'nocompatible'</a>&nbsp;takes care of this.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set backspace=indent,eol,start</div>
<br>
This specifies where in Insert mode the&nbsp;<span class="Special">&lt;BS&gt;</span>&nbsp;is allowed to delete the<br>
character in front of the cursor.&nbsp;&nbsp;The three items, separated by commas, tell<br>
Vim to delete the white space at the start of the line, a line break and the<br>
character before where Insert mode started.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set autoindent</div>
<br>
This makes Vim use the indent of the previous line for a newly created line.<br>
Thus there is the same amount of white space before the new line.&nbsp;&nbsp;For example<br>
when pressing&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;in Insert mode, and when using the &quot;o&quot; command to open a<br>
new line.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if has(&quot;vms&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set nobackup<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set backup<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
This tells Vim to keep a backup copy of a file when overwriting it.&nbsp;&nbsp;But not<br>
on the VMS system, since it keeps old versions of files already.&nbsp;&nbsp;The backup<br>
file will have the same name as the original file with &quot;~&quot; added.&nbsp;&nbsp;See&nbsp;<a class="Identifier" href="usr_07.html#07.4">07.4</a><br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set history=50</div>
<br>
Keep 50 commands and 50 search patterns in the history.&nbsp;&nbsp;Use another number if<br>
you want to remember fewer or more lines.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set ruler</div>
<br>
Always display the current cursor position in the lower right corner of the<br>
Vim window.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set showcmd</div>
<br>
Display an incomplete command in the lower right corner of the Vim window,<br>
left of the ruler.&nbsp;&nbsp;For example, when you type &quot;2f&quot;, Vim is waiting for you to<br>
type the character to find and &quot;2f&quot; is displayed.&nbsp;&nbsp;When you press &quot;w&quot; next,<br>
the &quot;2fw&quot; command is executed and the displayed &quot;2f&quot; is removed.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+-------------------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|text in the Vim window&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-- VISUAL --&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2f&nbsp;&nbsp;&nbsp;&nbsp; 43,8&nbsp;&nbsp; 17% |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+-------------------------------------------------+<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^^^^^^^^^^^&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^^^^^^^^ ^^^^^^^^^^<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Type" href="options.html#'showmode'">'showmode'</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Type" href="options.html#'showcmd'">'showcmd'</a>&nbsp;&nbsp;<a class="Type" href="options.html#'ruler'">'ruler'</a><br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set incsearch</div>
<br>
Display the match for a search pattern when halfway typing it.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map Q gq</div>
<br>
This defines a key mapping.&nbsp;&nbsp;More about that in the next section.&nbsp;&nbsp;This<br>
defines the &quot;Q&quot; command to do formatting with the &quot;gq&quot; operator.&nbsp;&nbsp;This is how<br>
it worked before Vim 5.0.&nbsp;&nbsp;Otherwise the &quot;Q&quot; command starts Ex mode, but you<br>
will not need it.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vnoremap _g y:exe &quot;grep /&quot; . escape(@&quot;, '\\/') . &quot;/ *.c *.h&quot;&lt;CR&gt;</div>
<br>
This mapping yanks the visually selected text and searches for it in C files.<br>
This is a complicated mapping.&nbsp;&nbsp;You can see that mappings can be used to do<br>
quite complicated things.&nbsp;&nbsp;Still, it is just a sequence of commands that are<br>
executed like you typed them.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if &amp;t_Co &gt; 2 || has(&quot;gui_running&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;syntax on<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set hlsearch<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
This switches on syntax highlighting, but only if colors are available.&nbsp;&nbsp;And<br>
the&nbsp;<a class="Type" href="options.html#'hlsearch'">'hlsearch'</a>&nbsp;option tells Vim to highlight matches with the last used search<br>
pattern.&nbsp;&nbsp;The &quot;if&quot; command is very useful to set options only when some<br>
condition is met.&nbsp;&nbsp;More about that in&nbsp;<a class="Identifier" href="usr_41.html">usr_41.txt</a>.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#vimrc-filetype" name="vimrc-filetype">vimrc-filetype</a>&nbsp;<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filetype plugin indent on</div>
<br>
This switches on three very clever mechanisms:<br>
1. Filetype detection.<br>
&nbsp;&nbsp; Whenever you start editing a file, Vim will try to figure out what kind of<br>
&nbsp;&nbsp; file this is.&nbsp;&nbsp;When you edit &quot;main.c&quot;, Vim will see the &quot;.c&quot; extension and<br>
&nbsp;&nbsp; recognize this as a &quot;c&quot; filetype.&nbsp;&nbsp;When you edit a file that starts with<br>
&nbsp;&nbsp; &quot;#!/bin/sh&quot;, Vim will recognize it as a &quot;sh&quot; filetype.<br>
&nbsp;&nbsp; The filetype detection is used for syntax highlighting and the other two<br>
&nbsp;&nbsp; items below.<br>
&nbsp;&nbsp; See&nbsp;<a class="Identifier" href="filetype.html#filetypes">filetypes</a>.<br>
<br>
2. Using filetype plugin files<br>
&nbsp;&nbsp; Many different filetypes are edited with different options.&nbsp;&nbsp;For example,<br>
&nbsp;&nbsp; when you edit a &quot;c&quot; file, it's very useful to set the&nbsp;<a class="Type" href="options.html#'cindent'">'cindent'</a>&nbsp;option to<br>
&nbsp;&nbsp; automatically indent the lines.&nbsp;&nbsp;These commonly useful option settings are<br>
&nbsp;&nbsp; included with Vim in filetype plugins.&nbsp;&nbsp;You can also add your own, see<br>
&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_41.html#write-filetype-plugin">write-filetype-plugin</a>.<br>
<br>
3. Using indent files<br>
&nbsp;&nbsp; When editing programs, the indent of a line can often be computed<br>
&nbsp;&nbsp; automatically.&nbsp;&nbsp;Vim comes with these indent rules for a number of<br>
&nbsp;&nbsp; filetypes.&nbsp;&nbsp;See&nbsp;<a class="Identifier" href="filetype.html#:filetype-indent-on">:filetype-indent-on</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'indentexpr'">'indentexpr'</a>.<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;autocmd FileType text setlocal textwidth=78</div>
<br>
This makes Vim break text to avoid lines getting longer than 78 characters.<br>
But only for files that have been detected to be plain text.&nbsp;&nbsp;There are<br>
actually two parts here.&nbsp;&nbsp;&quot;autocmd FileType text&quot; is an autocommand.&nbsp;&nbsp;This<br>
defines that when the file type is set to &quot;text&quot; the following command is<br>
automatically executed.&nbsp;&nbsp;&quot;setlocal textwidth=78&quot; sets the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option<br>
to 78, but only locally in one file.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#restore-cursor" name="restore-cursor">restore-cursor</a>&nbsp;<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;autocmd BufReadPost *<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ if line(&quot;'\&quot;&quot;) &gt; 1 &amp;&amp; line(&quot;'\&quot;&quot;) &lt;= line(&quot;$&quot;) |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\&nbsp;&nbsp; exe &quot;normal! g`\&quot;&quot; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ endif</div>
<br>
Another autocommand.&nbsp;&nbsp;This time it is used after reading any file.&nbsp;&nbsp;The<br>
complicated stuff after it checks if the '&quot; mark is defined, and jumps to it<br>
if so.&nbsp;&nbsp;The backslash at the start of a line is used to continue the command<br>
from the previous line.&nbsp;&nbsp;That avoids a line getting very long.<br>
See&nbsp;<a class="Identifier" href="repeat.html#line-continuation">line-continuation</a>.&nbsp;&nbsp;This only works in a Vim script file, not when<br>
typing commands at the command-line.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.3" name="05.3">05.3</a>&nbsp;&nbsp;Simple mappings<br>
<br>
A mapping enables you to bind a set of Vim commands to a single key.&nbsp;&nbsp;Suppose,<br>
for example, that you need to surround certain words with curly braces.&nbsp;&nbsp;In<br>
other words, you need to change a word such as &quot;amount&quot; into &quot;<span class="Special">{amount}</span>&quot;.&nbsp;&nbsp;With<br>
the :map command, you can tell Vim that the F5 key does this job.&nbsp;&nbsp;The command<br>
is as follows:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;F5&gt; i{&lt;Esc&gt;ea}&lt;Esc&gt;</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Todo">Note</span>:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When entering this command, you must enter&nbsp;<span class="Special">&lt;F5&gt;</span>&nbsp;by typing four<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters.&nbsp;&nbsp;Similarly,&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;is not entered by pressing the&nbsp;<span class="Special">&lt;Esc&gt;</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key, but by typing five characters.&nbsp;&nbsp;Watch out for this difference<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when reading the manual!<br>
<br>
Let's break this down:<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="Special">&lt;F5&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The F5 function key.&nbsp;&nbsp;This is the trigger key that causes the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command to be executed as the key is pressed.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;i{<span class="Special">&lt;Esc&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp; Insert the { character.&nbsp;&nbsp;The&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key ends Insert mode.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Move to the end of the word.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;a}<span class="Special">&lt;Esc&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp; Append the } to the word.<br>
<br>
After you execute the &quot;:map&quot; command, all you have to do to put {} around a<br>
word is to put the cursor on the first character and press F5.<br>
<br>
In this example, the trigger is a single key; it can be any string.&nbsp;&nbsp;But when<br>
you use an existing Vim command, that command will no longer be available.<br>
You better avoid that.<br>
&nbsp;&nbsp; One key that can be used with mappings is the backslash.&nbsp;&nbsp;Since you<br>
probably want to define more than one mapping, add another character.&nbsp;&nbsp;You<br>
could map &quot;\p&quot; to add parentheses around a word, and &quot;\c&quot; to add curly braces,<br>
for example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:map \p i(&lt;Esc&gt;ea)&lt;Esc&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:map \c i{&lt;Esc&gt;ea}&lt;Esc&gt;</div>
<br>
You need to type the \ and the p quickly after another, so that Vim knows they<br>
belong together.<br>
<br>
The &quot;:map&quot; command (with no arguments) lists your current mappings.&nbsp;&nbsp;At<br>
least the ones for Normal mode.&nbsp;&nbsp;More about mappings in section&nbsp;<a class="Identifier" href="usr_40.html#40.1">40.1</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.4" name="05.4">05.4</a>&nbsp;&nbsp;Adding a package&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#add-package" name="add-package">add-package</a>&nbsp;<a class="Constant" href="usr_05.html#matchit-install" name="matchit-install">matchit-install</a><br>
<br>
A package is a set of files that you can add to Vim.&nbsp;&nbsp;There are two kinds of<br>
packages: optional and automatically loaded on startup.<br>
<br>
The Vim distribution comes with a few packages that you can optionally use.<br>
For example, the matchit plugin.&nbsp;&nbsp;This plugin makes the &quot;%&quot; command jump to<br>
matching HTML tags, if/else/endif in Vim scripts, etc.&nbsp;&nbsp;Very useful, although<br>
it's not backwards compatible (that's why it is not enabled by default).<br>
<br>
To start using the matchit plugin, add one line to your vimrc file:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;packadd! matchit</div>
<br>
That's all!&nbsp;&nbsp;After restarting Vim you can find help about this plugin:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help matchit</div>
<br>
This works, because when&nbsp;<a class="Comment" href="repeat.html#:packadd">:packadd</a>&nbsp;loaded the plugin it also added the<br>
package directory in&nbsp;<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>, so that the help file can be found.<br>
<br>
You can find packages on the Internet in various places.&nbsp;&nbsp;It usually comes as<br>
an archive or as a repository.&nbsp;&nbsp;For an archive you can follow these steps:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1. create the package directory:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir -p ~/.vim/pack/fancy</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;fancy&quot; can be any name of your liking.&nbsp;&nbsp;Use one that describes the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; package.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2. unpack the archive in that directory.&nbsp;&nbsp;This assumes the top<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directory in the archive is &quot;start&quot;:<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cd ~/.vim/pack/fancy<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unzip /tmp/fancy.zip</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If the archive layout is different make sure that you end up with a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path like this:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">~/.vim/pack/fancy/start/fancytext/plugin/fancy.vim</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Here &quot;fancytext&quot; is the name of the package, it can be anything<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else.<br>
<br>
More information about packages can be found here:&nbsp;<a class="Identifier" href="repeat.html#packages">packages</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.5" name="05.5">05.5</a>&nbsp;&nbsp;Adding a plugin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#add-plugin" name="add-plugin">add-plugin</a>&nbsp;<a class="Constant" href="usr_05.html#plugin" name="plugin">plugin</a><br>
<br>
Vim's functionality can be extended by adding plugins.&nbsp;&nbsp;A plugin is nothing<br>
more than a Vim script file that is loaded automatically when Vim starts.&nbsp;&nbsp;You<br>
can add a plugin very easily by dropping it in your plugin directory.<br>
<span class="Special">{not available when Vim was compiled without the&nbsp;</span><a class="Identifier" href="various.html#+eval">+eval</a><span class="Special">&nbsp;feature}</span><br>
<br>
There are two types of plugins:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;global plugin: Used for all kinds of files<br>
&nbsp;&nbsp;filetype plugin: Only used for a specific type of file<br>
<br>
The global plugins will be discussed first, then the filetype ones<br>
<a class="Identifier" href="usr_05.html#add-filetype-plugin">add-filetype-plugin</a>.<br>
<br>
<br>
<span class="Statement">GLOBAL PLUGINS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="usr_05.html#standard-plugin" name="standard-plugin">standard-plugin</a><br>
<br>
When you start Vim, it will automatically load a number of global plugins.<br>
You don't have to do anything for this.&nbsp;&nbsp;They add functionality that most<br>
people will want to use, but which was implemented as a Vim script instead of<br>
being compiled into Vim.&nbsp;&nbsp;You can find them listed in the help index<br>
<a class="Identifier" href="index.html#standard-plugin-list">standard-plugin-list</a>.&nbsp;&nbsp;Also see&nbsp;<a class="Identifier" href="starting.html#load-plugins">load-plugins</a>.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#add-global-plugin" name="add-global-plugin">add-global-plugin</a><br>
You can add a global plugin to add functionality that will always be present<br>
when you use Vim.&nbsp;&nbsp;There are only two steps for adding a global plugin:<br>
1. Get a copy of the plugin.<br>
2. Drop it in the right directory.<br>
<br>
<br>
GETTING A GLOBAL PLUGIN<br>
<br>
Where can you find plugins?<br>
- Some come with Vim.&nbsp;&nbsp;You can find them in the directory $VIMRUNTIME/macros<br>
&nbsp;&nbsp;and its sub-directories.<br>
- Download from the net.&nbsp;&nbsp;There is a large collection on&nbsp;<span class="Constant"><a href="http://www.vim.org">http://www.vim.org</a></span>.<br>
- They are sometimes posted in a Vim&nbsp;<a class="Identifier" href="intro.html#maillist">maillist</a>.<br>
- You could write one yourself, see&nbsp;<a class="Identifier" href="usr_41.html#write-plugin">write-plugin</a>.<br>
<br>
Some plugins come as a vimball archive, see&nbsp;<a class="Identifier" href="pi_vimball.html#vimball">vimball</a>.<br>
Some plugins can be updated automatically, see&nbsp;<a class="Identifier" href="pi_getscript.html#getscript">getscript</a>.<br>
<br>
<br>
USING A GLOBAL PLUGIN<br>
<br>
First read the text in the plugin itself to check for any special conditions.<br>
Then copy the file to your plugin directory:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">system&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;plugin directory</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unix&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/plugin/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PC and OS/2&nbsp;&nbsp;&nbsp;&nbsp; $HOME/vimfiles/plugin or $VIM/vimfiles/plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amiga&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s:vimfiles/plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Macintosh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $VIM:vimfiles:plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mac OS X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/plugin/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RISC-OS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Choices:vimfiles.plugin<br>
<br>
Example for Unix (assuming you didn't have a plugin directory yet):<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir ~/.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir ~/.vim/plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp /tmp/yourplugin.vim ~/.vim/plugin</div>
<br>
That's all!&nbsp;&nbsp;Now you can use the commands defined in this plugin.<br>
<br>
Instead of putting plugins directly into the plugin/ directory, you may<br>
better organize them by putting them into subdirectories under plugin/.<br>
As an example, consider using &quot;~/.vim/plugin/perl/*.vim&quot; for all your Perl<br>
plugins.<br>
<br>
<br>
<span class="Statement">FILETYPE PLUGINS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="usr_05.html#add-filetype-plugin" name="add-filetype-plugin">add-filetype-plugin</a>&nbsp;<a class="Constant" href="usr_05.html#ftplugins" name="ftplugins">ftplugins</a><br>
<br>
The Vim distribution comes with a set of plugins for different filetypes that<br>
you can start using with this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:filetype plugin on</div>
<br>
That's all!&nbsp;&nbsp;See&nbsp;<a class="Identifier" href="usr_05.html#vimrc-filetype">vimrc-filetype</a>.<br>
<br>
If you are missing a plugin for a filetype you are using, or you found a<br>
better one, you can add it.&nbsp;&nbsp;There are two steps for adding a filetype plugin:<br>
1. Get a copy of the plugin.<br>
2. Drop it in the right directory.<br>
<br>
<br>
GETTING A FILETYPE PLUGIN<br>
<br>
You can find them in the same places as the global plugins.&nbsp;&nbsp;Watch out if the<br>
type of file is mentioned, then you know if the plugin is a global or a<br>
filetype one.&nbsp;&nbsp;The scripts in $VIMRUNTIME/macros are global ones, the filetype<br>
plugins are in $VIMRUNTIME/ftplugin.<br>
<br>
<br>
<span class="Statement">USING A FILETYPE PLUGIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="usr_05.html#ftplugin-name" name="ftplugin-name">ftplugin-name</a><br>
<br>
You can add a filetype plugin by dropping it in the right directory.&nbsp;&nbsp;The<br>
name of this directory is in the same directory mentioned above for global<br>
plugins, but the last part is &quot;ftplugin&quot;.&nbsp;&nbsp;Suppose you have found a plugin for<br>
the &quot;stuff&quot; filetype, and you are on Unix.&nbsp;&nbsp;Then you can move this file to the<br>
ftplugin directory:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv thefile ~/.vim/ftplugin/stuff.vim</div>
<br>
If that file already exists you already have a plugin for &quot;stuff&quot;.&nbsp;&nbsp;You might<br>
want to check if the existing plugin doesn't conflict with the one you are<br>
adding.&nbsp;&nbsp;If it's OK, you can give the new one another name:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv thefile ~/.vim/ftplugin/stuff_too.vim</div>
<br>
The underscore is used to separate the name of the filetype from the rest,<br>
which can be anything.&nbsp;&nbsp;If you use &quot;otherstuff.vim&quot; it wouldn't work, it would<br>
be loaded for the &quot;otherstuff&quot; filetype.<br>
<br>
On MS-DOS you cannot use long filenames.&nbsp;&nbsp;You would run into trouble if you<br>
add a second plugin and the filetype has more than six characters.&nbsp;&nbsp;You can<br>
use an extra directory to get around this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkdir $VIM/vimfiles/ftplugin/fortran<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;copy thefile $VIM/vimfiles/ftplugin/fortran/too.vim</div>
<br>
The generic names for the filetype plugins are:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ftplugin/&lt;filetype&gt;.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ftplugin/&lt;filetype&gt;_&lt;name&gt;.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ftplugin/&lt;filetype&gt;/&lt;name&gt;.vim</div>
<br>
Here &quot;<span class="Special">&lt;name&gt;</span>&quot; can be any name that you prefer.<br>
Examples for the &quot;stuff&quot; filetype on Unix:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/ftplugin/stuff.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/ftplugin/stuff_def.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/ftplugin/stuff/header.vim</div>
<br>
The&nbsp;<span class="Special">&lt;filetype&gt;</span>&nbsp;part is the name of the filetype the plugin is to be used for.<br>
Only files of this filetype will use the settings from the plugin.&nbsp;&nbsp;The&nbsp;<span class="Special">&lt;name&gt;</span><br>
part of the plugin file doesn't matter, you can use it to have several plugins<br>
for the same filetype.&nbsp;&nbsp;<span class="Todo">Note</span>&nbsp;that it must end in &quot;.vim&quot;.<br>
<br>
<br>
Further reading:<br>
<a class="Identifier" href="filetype.html#filetype-plugins">filetype-plugins</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Documentation for the filetype plugins and information<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;about how to avoid that mappings cause problems.<br>
<a class="Identifier" href="starting.html#load-plugins">load-plugins</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When the global plugins are loaded during startup.<br>
<a class="Identifier" href="filetype.html#ftplugin-overrule">ftplugin-overrule</a>&nbsp;&nbsp;&nbsp;&nbsp; Overruling the settings from a global plugin.<br>
<a class="Identifier" href="usr_41.html#write-plugin">write-plugin</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How to write a plugin script.<br>
<a class="Identifier" href="filetype.html#plugin-details">plugin-details</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For more information about using plugins or when your<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;plugin doesn't work.<br>
<a class="Identifier" href="filetype.html#new-filetype">new-filetype</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How to detect a new file type.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.6" name="05.6">05.6</a>&nbsp;&nbsp;Adding a help file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="usr_05.html#add-local-help" name="add-local-help">add-local-help</a><br>
<br>
If you are lucky, the plugin you installed also comes with a help file.&nbsp;&nbsp;We<br>
will explain how to install the help file, so that you can easily find help<br>
for your new plugin.<br>
&nbsp;&nbsp; Let us use the &quot;doit.vim&quot; plugin as an example.&nbsp;&nbsp;This plugin comes with<br>
documentation: &quot;doit.txt&quot;.&nbsp;&nbsp;Let's first copy the plugin to the right<br>
directory.&nbsp;&nbsp;This time we will do it from inside Vim.&nbsp;&nbsp;(You may skip some of<br>
the &quot;mkdir&quot; commands if you already have the directory.)<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:!mkdir ~/.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:!mkdir ~/.vim/plugin<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:!cp /tmp/doit.vim ~/.vim/plugin</div>
<br>
The &quot;cp&quot; command is for Unix, on MS-DOS you can use &quot;copy&quot;.<br>
<br>
Now create a &quot;doc&quot; directory in one of the directories in&nbsp;<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:!mkdir ~/.vim/doc</div>
<br>
Copy the help file to the &quot;doc&quot; directory.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:!cp /tmp/doit.txt ~/.vim/doc</div>
<br>
Now comes the trick, which allows you to jump to the subjects in the new help<br>
file: Generate the local tags file with the&nbsp;<a class="Identifier" href="helphelp.html#:helptags">:helptags</a>&nbsp;command.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:helptags ~/.vim/doc</div>
<br>
Now you can use the<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help doit</div>
<br>
command to find help for &quot;doit&quot; in the help file you just added.&nbsp;&nbsp;You can see<br>
an entry for the local help file when you do:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help local-additions</div>
<br>
The title lines from the local help files are automagically added to this<br>
section.&nbsp;&nbsp;There you can see which local help files have been added and jump to<br>
them through the tag.<br>
<br>
For writing a local help file, see&nbsp;<a class="Identifier" href="usr_41.html#write-local-help">write-local-help</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.7" name="05.7">05.7</a>&nbsp;&nbsp;The option window<br>
<br>
If you are looking for an option that does what you want, you can search in<br>
the help files here:&nbsp;<a class="Identifier" href="options.html#options">options</a>.&nbsp;&nbsp;Another way is by using this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:options</div>
<br>
This opens a new window, with a list of options with a one-line explanation.<br>
The options are grouped by subject.&nbsp;&nbsp;Move the cursor to a subject and press<br>
<span class="Special">&lt;Enter&gt;</span>&nbsp;to jump there.&nbsp;&nbsp;Press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;again to jump back.&nbsp;&nbsp;Or use&nbsp;<span class="Special">CTRL-O</span>.<br>
<br>
You can change the value of an option.&nbsp;&nbsp;For example, move to the &quot;displaying<br>
text&quot; subject.&nbsp;&nbsp;Then move the cursor down to this line:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">set wrap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nowrap</span><br>
<br>
When you hit&nbsp;<span class="Special">&lt;Enter&gt;</span>, the line will change to:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">set nowrap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wrap</span><br>
<br>
The option has now been switched off.<br>
<br>
Just above this line is a short description of the&nbsp;<a class="Type" href="options.html#'wrap'">'wrap'</a>&nbsp;option.&nbsp;&nbsp;Move the<br>
cursor one line up to place it in this line.&nbsp;&nbsp;Now hit&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;and you jump to<br>
the full help on the&nbsp;<a class="Type" href="options.html#'wrap'">'wrap'</a>&nbsp;option.<br>
<br>
For options that take a number or string argument you can edit the value.<br>
Then press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;to apply the new value.&nbsp;&nbsp;For example, move the cursor a few<br>
lines up to this line:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">set so=0</span><br>
<br>
Position the cursor on the zero with &quot;$&quot;.&nbsp;&nbsp;Change it into a five with &quot;r5&quot;.<br>
Then press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;to apply the new value.&nbsp;&nbsp;When you now move the cursor<br>
around you will notice that the text starts scrolling before you reach the<br>
border.&nbsp;&nbsp;This is what the&nbsp;<a class="Type" href="options.html#'scrolloff'">'scrolloff'</a>&nbsp;option does, it specifies an offset<br>
from the window border where scrolling starts.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_05.html#05.8" name="05.8">05.8</a>&nbsp;&nbsp;Often used options<br>
<br>
There are an awful lot of options.&nbsp;&nbsp;Most of them you will hardly ever use.<br>
Some of the more useful ones will be mentioned here.&nbsp;&nbsp;Don't forget you can<br>
find more help on these options with the &quot;:help&quot; command, with single quotes<br>
before and after the option name.&nbsp;&nbsp;For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:help 'wrap'</div>
<br>
In case you have messed up an option value, you can set it back to the<br>
default by putting an ampersand (&amp;) after the option name.&nbsp;&nbsp;Example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword&amp;</div>
<br>
<br>
NOT WRAPPING LINES<br>
<br>
Vim normally wraps long lines, so that you can see all of the text.&nbsp;&nbsp;Sometimes<br>
it's better to let the text continue right of the window.&nbsp;&nbsp;Then you need to<br>
scroll the text left-right to see all of a long line.&nbsp;&nbsp;Switch wrapping off<br>
with this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set nowrap</div>
<br>
Vim will automatically scroll the text when you move to text that is not<br>
displayed.&nbsp;&nbsp;To see a context of ten characters, do this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set sidescroll=10</div>
<br>
This doesn't change the text in the file, only the way it is displayed.<br>
<br>
<br>
WRAPPING MOVEMENT COMMANDS<br>
<br>
Most commands for moving around will stop moving at the start and end of a<br>
line.&nbsp;&nbsp;You can change that with the&nbsp;<a class="Type" href="options.html#'whichwrap'">'whichwrap'</a>&nbsp;option.&nbsp;&nbsp;This sets it to the<br>
default value:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set whichwrap=b,s</div>
<br>
This allows the&nbsp;<span class="Special">&lt;BS&gt;</span>&nbsp;key, when used in the first position of a line, to move<br>
the cursor to the end of the previous line.&nbsp;&nbsp;And the&nbsp;<span class="Special">&lt;Space&gt;</span>&nbsp;key moves from<br>
the end of a line to the start of the next one.<br>
<br>
To allow the cursor keys&nbsp;<span class="Special">&lt;Left&gt;</span>&nbsp;and&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;to also wrap, use this command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set whichwrap=b,s,&lt;,&gt;</div>
<br>
This is still only for Normal mode.&nbsp;&nbsp;To let&nbsp;<span class="Special">&lt;Left&gt;</span>&nbsp;and&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;do this in<br>
Insert mode as well:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set whichwrap=b,s,&lt;,&gt;,[,]</div>
<br>
There are a few other flags that can be added, see&nbsp;<a class="Type" href="options.html#'whichwrap'">'whichwrap'</a>.<br>
<br>
<br>
VIEWING TABS<br>
<br>
When there are tabs in a file, you cannot see where they are.&nbsp;&nbsp;To make them<br>
visible:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set list</div>
<br>
Now every tab is displayed as ^I.&nbsp;&nbsp;And a $ is displayed at the end of each<br>
line, so that you can spot trailing spaces that would otherwise go unnoticed.<br>
&nbsp;&nbsp; A disadvantage is that this looks ugly when there are many Tabs in a file.<br>
If you have a color terminal, or are using the GUI, Vim can show the spaces<br>
and tabs as highlighted characters.&nbsp;&nbsp;Use the&nbsp;<a class="Type" href="options.html#'listchars'">'listchars'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set listchars=tab:&gt;-,trail:-</div>
<br>
Now every tab will be displayed as &quot;&gt;---&quot; (with more or less &quot;-&quot;) and trailing<br>
white space as &quot;-&quot;.&nbsp;&nbsp;Looks a lot better, doesn't it?<br>
<br>
<br>
KEYWORDS<br>
<br>
The&nbsp;<a class="Type" href="options.html#'iskeyword'">'iskeyword'</a>&nbsp;option specifies which characters can appear in a word:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">iskeyword=@,48-57,_,192-255</span><br>
<br>
The &quot;@&quot; stands for all alphabetic letters.&nbsp;&nbsp;&quot;48-57&quot; stands for ASCII<br>
characters 48 to 57, which are the numbers 0 to 9.&nbsp;&nbsp;&quot;192-255&quot; are the<br>
printable latin characters.<br>
&nbsp;&nbsp; Sometimes you will want to include a dash in keywords, so that commands<br>
like &quot;w&quot; consider &quot;upper-case&quot; to be one word.&nbsp;&nbsp;You can do it like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword+=-<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">iskeyword=@,48-57,_,192-255,-</span><br>
<br>
If you look at the new value, you will see that Vim has added a comma for you.<br>
&nbsp;&nbsp; To remove a character use &quot;-=&quot;.&nbsp;&nbsp;For example, to remove the underscore:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword-=_<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">iskeyword=@,48-57,192-255,-</span><br>
<br>
This time a comma is automatically deleted.<br>
<br>
<br>
ROOM FOR MESSAGES<br>
<br>
When Vim starts there is one line at the bottom that is used for messages.<br>
When a message is long, it is either truncated, thus you can only see part of<br>
it, or the text scrolls and you have to press&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;to continue.<br>
&nbsp;&nbsp; You can set the&nbsp;<a class="Type" href="options.html#'cmdheight'">'cmdheight'</a>&nbsp;option to the number of lines used for<br>
messages.&nbsp;&nbsp;Example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set cmdheight=3</div>
<br>
This does mean there is less room to edit text, thus it's a compromise.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<br>
Next chapter:&nbsp;<a class="Identifier" href="usr_06.html">usr_06.txt</a>&nbsp;&nbsp;Using syntax highlighting<br>
<br>
Copyright: see&nbsp;<a class="Identifier" href="usr_01.html#manual-copyright">manual-copyright</a>&nbsp;&nbsp;vim:tw=78:ts=8:ft=help:norl:<br>
</div>

</article>

<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
  <span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>

<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->

</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
